@extends('hrs.layouts.app')  
@section('css')


        <link href="{{asset('hrs/plugins/ladda-buttons/css/ladda-themeless.min.css')}}" rel="stylesheet" type="text/css" /> 
  
@endsection         
@section('content')

            <div class="container">
                    @if(session('rs'))
                              <div class="alert alert-{{session('rs')['status']}}">
                                {{ session('rs')['msg'] }}
                              </div>
                    @endif
              
                <div class="row">
                    <div class="col-sm-12">

                        <div class="card-box">
                        
                          
                            <div class="row">
                              
                                <div class="col-lg-12">
            
                                    <h5 class="text-muted text-uppercase m-t-0 m-b-10"><b>修改费目</b></h5>
                                        
                                      
                            <div class="row fee">
                                <hr/>
                                <form method="post" action="{{url('/itemfees',$data->id)}}" id="form2">
                                    @method('PUT')
                                        <div class="form-group m-b-10 col-md-12">
                                            <label>费目<span class="text-danger">*</span></label>
                                            <input type="text" class="form-control" placeholder="" name="fee_name"  value="{{$data->fee_name}}" required="">
                                        </div>
                                         <div class="form-group m-b-10 col-md-4">
                                            <label>应收<span class="text-danger">*</span></label>
                                            <input type="text" class="form-control" placeholder="" name="receive_money" value="{{$data->receive_money}}">
                                        </div>
                                        <div class="form-group m-b-10 col-md-4">
                                            <label>应收状态<span class="text-danger">*</span></label>
                                        <select name="receive_status" class="form-control" >
                                                    
                                                    <option value="1" {{$data->pay_status=='1'?'selected':''}}>已收</option>
                                                    <option value="0" {{$data->pay_status=='0'?'selected':''}}>未收</option>
                                                </select>
                                        </div>        
                                         <div class="form-group m-b-10 col-md-4">
                                            <label>应收关系人<span class="text-danger">*</span></label>
                                            <input type="text" class="form-control" placeholder="" name="receive_contacter" value="{{$data->receive_contacter}}">
                                        </div>
                                         <div class="form-group m-b-10 col-md-4">
                                            <label>应付<span class="text-danger">*</span></label>
                                            <input type="text" class="form-control" placeholder="" name="pay_money" value="{{$data->pay_money}}">
                                        </div>
                                        <div class="form-group m-b-10 col-md-4">
                                            <label>应付状态<span class="text-danger">*</span></label>
                                        <select name="pay_status" class="change-stauts form-control">
                                                    
                                                    <option value="1" {{$data->pay_status=='1'?'selected':''}}>已付</option>
                                                    <option value="0" {{$data->pay_status=='0'?'selected':''}}>未付</option>
                                                </select>
                                        </div>        
                                        <div class="form-group m-b-10 col-md-4">
                                            <label>应付关系人<span class="text-danger">*</span></label>
                                            <input type="text" class="form-control" placeholder="" name="pay_contacter" value="{{$data->pay_contacter}}">
                                        </div>
                                        <div class="form-group m-b-10 col-md-4">
                                            <label>备注</label>
                                            <input type="text" class="form-control" placeholder="" name="fee_remark" value="{{$data->fee_remark}}">
                                        </div>
                                      

                             
                                     
        
            <div class="form-group m-b-10 col-md-12">
                 <button type="submit" class="btn w-sm btn-info waves-effect waves-light" id="add-fee">更新费用</button>
            </div>
            <input type="hidden" name="item_id" value="{{$data->item_id}}">
            {{ csrf_field()}} 
            </form> 
        </div>
                             
   
                                </div>
                                    
                            </div>
                           

  
                        
                        
                    </div>
                </div>
 </div>
               

            </div> <!-- end container -->
@endsection        

        
@section('js')
  <!-- Modal-Effect -->
<script src="{{asset('hrs/plugins/ladda-buttons/js/spin.min.js')}}"></script>
<script src="{{asset('hrs/plugins/ladda-buttons/js/ladda.min.js')}}"></script>
<script src="{{asset('hrs/plugins/ladda-buttons/js/ladda.jquery.min.js')}}"></script>
<script src="{{asset('js/sweetalert.min.js')}}"></script>
    <script type="text/javascript">
        $('.change-stauts').on('change',function(){
            var _this = $(this);
            var data = {};
             data.id = _this.data('id');
             data.type = _this.data('type');
             data.status = _this.val();
             var url = "{{url('itemfees/change-status')}}";
             $.get(url,data,function(rs){
                if(rs.status) {
                    window.location.reload();
                } else {
                    alert('操作失败');
                }
             });

        });

        

        $('#add-fee').on('click',function(e){
             e.preventDefault();
            var l = Ladda.create(this);
            l.start();
            $('#form2').submit();        
           
            return false;
        });

        $('.btn-fee').on('click',function(){
            $('.fee').show();
        });

       
    </script>
@endsection

